<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>指令语法</title>
  </head>
  <body>
    <div id="app">
      <a v-bind:href="url">去学习IT技术</a>
      <br />
      <button v-on:click="confirm">确认一下</button>
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.2.31/vue.global.min.js"></script>
    <script>
      const { createApp } = Vue

      createApp({
        data() {
          return {
            url: 'http://www.atguigu.com',
          }
        },

        // methods中配置的方法，模板中可以直接调用
        methods: {
          confirm() {
            if (window.confirm('确定要来学习吗？')) {
              window.location.href = 'http://www.atguigu.com'
            }
          },
        },
      }).mount('#app')
    </script>
  </body>
</html>
